<!--
 * @FilePath     : /study_code/layui/13-2-23.html
 * @Description  : cols[0].LAY_CHECKED 复选框是否默认全选
 * @Date         : 2025-04-07 17:14:25
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-08 14:23:21
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="/layui/dist/css/layui.css" />
  </head>
  <body>
    <table id="demo" lay-filter="test"></table>

    <script src="/layui/dist/layui.js"></script>
    <script src="/layui/table/common.js"></script>
    <script>
      var table = layui.table

      table.render({
        elem: '#demo',
        data: tableData,
        /**
         * @brief: 是否全选状态
         * 【前提】必须复选框列开启后才有效
         * @key {boolean} LAY_CHECKED
         * @value {boolean}
         * false （def）复选不全部选中
         * true 复选默认全部选中
         */
        // , LAY_CHECKED: false
        // , LAY_CHECKED: true
        cols: [[
          {
            type: 'checkbox',
            LAY_CHECKED: true,
          },
          {
            field: 'id',
            title: 'ID',
          }
        ]],
      })
    </script>
  </body>
</html>